Telegram Group & Telegram Channel
Calculates the date of n days ago from today.

Use datetime.date.today() to get the current day.

Use datetime.timedelta to subtract n days from today's date.


Code:


from datetime import timedelta, date

def days_ago(n):
return date.today() - timedelta(n)

EXAMPLE

days_ago(5)

Output:
date(2020, 10, 23)

Share and Support
@Python_Codes



tg-me.com/python_codes/147
Create:
Last Update:

Calculates the date of n days ago from today.

Use datetime.date.today() to get the current day.

Use datetime.timedelta to subtract n days from today's date.


Code:


from datetime import timedelta, date

def days_ago(n):
return date.today() - timedelta(n)

EXAMPLE

days_ago(5)

Output:
date(2020, 10, 23)

Share and Support
@Python_Codes

BY Python Codes


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/python_codes/147

View MORE
Open in Telegram


Python Codes Telegram | DID YOU KNOW?

Date: |

Why Telegram?

Telegram has no known backdoors and, even though it is come in for criticism for using proprietary encryption methods instead of open-source ones, those have yet to be compromised. While no messaging app can guarantee a 100% impermeable defense against determined attackers, Telegram is vulnerabilities are few and either theoretical or based on spoof files fooling users into actively enabling an attack.

Importantly, that investor viewpoint is not new. It cycles in when conditions are right (and vice versa). It also brings the ineffective warnings of an overpriced market with it.Looking toward a good 2022 stock market, there is no apparent reason to expect these issues to change.

Python Codes from no


Telegram Python Codes
FROM USA